    Imports System
    Imports System.Data
    Imports System.Configuration
    Imports System.Web
    Imports System.Web.Security
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Web.UI.WebControls.WebParts
    Imports System.Web.UI.HtmlControls
    Imports System.Text
    Imports System.IO
    
Namespace Training1.UI
    
    ''' <summary>
    ''' Summary description for Parser: Parser for files like csv, excel etc.
    ''' </summary>
    Public MustInherit Class Parser

        ' The type of file. ie, extension of the file.
        Public Enum FileTypes
            CSV
        End Enum
        
        ' Constructor
        Public Sub New()
            MyBase.New
            
        End Sub

        ' Reset resources
        Public MustOverride Sub Reset()

        ' Get one record at a time
        Public MustOverride Function GetNextRow() As String()

        'Close parser and dispose parser object
        Public MustOverride Sub Close()
        ' Generic function to get instance of parser class based on file type.
        Public Shared Function GetParser(ByVal filePath As String, ByVal type As FileTypes) As Parser
            Dim parsr As Parser = Nothing
            Select Case (type)
                Case FileTypes.CSV
                    parsr = New CsvParser(filePath)
            End Select
            Return parsr
        End Function
        
    End Class
End Namespace

